import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:yqmssa_app/config/app_config.dart';
import 'package:yqmssa_app/router/page_router.dart';

class DisagreeDialogWidget extends StatelessWidget {
  const DisagreeDialogWidget({super.key});

  @override
  Widget build(BuildContext context) {
    return Material(
      type: MaterialType.transparency,
      child: Center(
        child: Container(
          width: double.maxFinite,
          margin: const EdgeInsets.symmetric(horizontal: 20),
          padding: const EdgeInsets.symmetric(horizontal: 16),
          decoration: BoxDecoration(
            color: Colors.white,
            borderRadius: BorderRadius.circular(10),
            border: Border.all(color: const Color(0XFFEBEDF0), width: 1),
          ),
          child: Column(
            mainAxisSize: MainAxisSize.min,
            children: [
              const SizedBox(height: 26),
              Center(
                child: Align(
                  alignment: Alignment.centerLeft,
                  child: RichText(
                    text: TextSpan(style: const TextStyle(color: Color(0XFF666666), fontSize: 13, height: 1.6), children: [
                      const TextSpan(text: "若您不同意"),
                      WidgetSpan(
                        child: InkWell(
                          onTap: () {
                            Get.toNamed(PageRouter.agreement, parameters: {"title": "用户注册协议", "url": AppConfig.xieYIData.userAgreementUrl});
                          },
                          child: const Text(
                            '《注册协议》',
                            style: TextStyle(
                              color: Color(0XFFFF6800),
                              fontSize: 13,
                              decoration: TextDecoration.underline,
                              fontWeight: FontWeight.bold,
                            ),
                          ),
                        ),
                      ),
                      const TextSpan(
                        text: '与',
                        style: TextStyle(
                          fontWeight: FontWeight.bold,
                        ),
                      ),
                      WidgetSpan(
                          child: InkWell(
                              onTap: () {
                                Get.toNamed(PageRouter.agreement, parameters: {"title": "隐私政策", "url": AppConfig.xieYIData.privacyAgreementUrl});
                              },
                              child: const Text(
                                '《隐私政策》',
                                style: TextStyle(
                                  color: Color(0XFFFF6800),
                                  fontSize: 13,
                                  decoration: TextDecoration.underline,
                                  fontWeight: FontWeight.bold,
                                ),
                              ))),
                      const TextSpan(
                        text: "我们不会收集可能直接识别您的个人信息，您仍可使用基本功能模式，以实现基础功能使用",
                      ),
                    ]),
                  ),
                ),
              ),
              const SizedBox(height: 20),
              GestureDetector(
                behavior: HitTestBehavior.translucent,
                onTap: () {
                  Get.back(result: true);
                },
                child: Container(
                  height: 44,
                  alignment: Alignment.center,
                  decoration: BoxDecoration(
                    color: const Color(0XFFFF6800),
                    borderRadius: BorderRadius.circular(8),
                  ),
                  child: const Text(
                    "同意，进入完整功能模式",
                    textAlign: TextAlign.center,
                    style: TextStyle(
                      fontSize: 16,
                      color: Colors.white,
                    ),
                  ),
                ),
              ),
              const SizedBox(height: 12),
              GestureDetector(
                behavior: HitTestBehavior.translucent,
                onTap: () {
                  Get.back(result: false);
                },
                child: Container(
                  height: 44,
                  alignment: Alignment.center,
                  decoration: BoxDecoration(
                    borderRadius: BorderRadius.circular(8),
                    border: Border.all(width: 1, color: const Color(0XFFFF6800)),
                  ),
                  child: const Text(
                    "不同意，进入基础功能模式",
                    textAlign: TextAlign.center,
                    style: TextStyle(fontSize: 16, color: Color(0XFFFF6800)),
                  ),
                ),
              ),
              const SizedBox(height: 20),
            ],
          ),
        ),
      ),
    );
  }
}
